﻿using System;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Data.SqlClient;

public class tbUserDB
{
    #region[tbUsers_Add]
    public static bool tbUsers_Add(tbUsersDATA _tbUsersDATA)
    {
        bool check = false;
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbUsers_Add", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@dpID", _tbUsersDATA.dpID));
                dbCmd.Parameters.Add(new SqlParameter("@psID", _tbUsersDATA.psID));
                dbCmd.Parameters.Add(new SqlParameter("@uCode", _tbUsersDATA.uCode));
                dbCmd.Parameters.Add(new SqlParameter("@uUser", _tbUsersDATA.uUser));
                dbCmd.Parameters.Add(new SqlParameter("@uPass", _tbUsersDATA.uPass));
                dbCmd.Parameters.Add(new SqlParameter("@uName", _tbUsersDATA.uName));
                dbCmd.Parameters.Add(new SqlParameter("@uDate", _tbUsersDATA.uDate));
                dbCmd.Parameters.Add(new SqlParameter("@uAdd", _tbUsersDATA.uAdd));
                dbCmd.Parameters.Add(new SqlParameter("@uTel", _tbUsersDATA.uTel));
                dbCmd.Parameters.Add(new SqlParameter("@uLevel", _tbUsersDATA.uLevel));
                dbCmd.Parameters.Add(new SqlParameter("@uOrd", _tbUsersDATA.uOrd));
                dbCmd.Parameters.Add(new SqlParameter("@uEmail", _tbUsersDATA.uEmail));
                dbCmd.Parameters.Add(new SqlParameter("@uAdmin", _tbUsersDATA.uAdmin));
                dbCmd.Parameters.Add(new SqlParameter("@uImg", _tbUsersDATA.uImg));
                dbCmd.Parameters.Add(new SqlParameter("@uCN", _tbUsersDATA.uCN));
                dbCmd.Parameters.Add(new SqlParameter("@paId", _tbUsersDATA.paId));
                dbCmd.ExecuteNonQuery();
                dbConn.Close();
                check = true;
            }
        }
        return check;
    }
    #endregion
    #region[tbUsers_Update]
    public static bool tbUsers_Update(tbUsersDATA _tbUsersDATA)
    {
        bool check = false;
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbUsers_Update", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uID", _tbUsersDATA.uID));
                dbCmd.Parameters.Add(new SqlParameter("@dpID", _tbUsersDATA.dpID));
                dbCmd.Parameters.Add(new SqlParameter("@psID", _tbUsersDATA.psID));
                dbCmd.Parameters.Add(new SqlParameter("@uCode", _tbUsersDATA.uCode));
                dbCmd.Parameters.Add(new SqlParameter("@uUser", _tbUsersDATA.uUser));
                dbCmd.Parameters.Add(new SqlParameter("@uPass", _tbUsersDATA.uPass));
                dbCmd.Parameters.Add(new SqlParameter("@uName", _tbUsersDATA.uName));
                dbCmd.Parameters.Add(new SqlParameter("@uDate", _tbUsersDATA.uDate));
                dbCmd.Parameters.Add(new SqlParameter("@uAdd", _tbUsersDATA.uAdd));
                dbCmd.Parameters.Add(new SqlParameter("@uTel", _tbUsersDATA.uTel));
                dbCmd.Parameters.Add(new SqlParameter("@uLevel", _tbUsersDATA.uLevel));
                dbCmd.Parameters.Add(new SqlParameter("@uOrd", _tbUsersDATA.uOrd));
                dbCmd.Parameters.Add(new SqlParameter("@uEmail", _tbUsersDATA.uEmail));
                dbCmd.Parameters.Add(new SqlParameter("@uAdmin", _tbUsersDATA.uAdmin));
                dbCmd.Parameters.Add(new SqlParameter("@uImg", _tbUsersDATA.uImg));
                dbCmd.Parameters.Add(new SqlParameter("@uCN", _tbUsersDATA.uCN));
                dbCmd.Parameters.Add(new SqlParameter("@paId", _tbUsersDATA.paId));
                dbCmd.ExecuteNonQuery();
                dbConn.Close();
                check = true;
            }
        }
        return check;
    }
    #endregion
    #region[tbUsers_Update_Level]
    public static bool tbUsers_Update_Level(tbUsersDATA _tbUsersDATA)
    {
        bool check = false;
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbUsers_Update_Level", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uID", _tbUsersDATA.uID));
                dbCmd.Parameters.Add(new SqlParameter("@uLevel", _tbUsersDATA.uLevel));
                dbCmd.Parameters.Add(new SqlParameter("@uOrd", _tbUsersDATA.uOrd));
                dbCmd.ExecuteNonQuery();
                dbConn.Close();
                check = true;
            }
        }
        return check;
    }
    #endregion
    #region[tbUsers_Update_uCN]
    public static bool tbUsers_Update_uCN(tbUsersDATA _tbUsersDATA)
    {
        bool check = false;
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbUsers_Update_uCN", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uID", _tbUsersDATA.uID));
                dbCmd.Parameters.Add(new SqlParameter("@uCN", _tbUsersDATA.uCN));
                dbCmd.ExecuteNonQuery();
                dbConn.Close();
                check = true;
            }
        }
        return check;
    }
    #endregion
    #region[tbUsers_ChangePass]
    public static bool tbUsers_ChangePass(tbUsersDATA _tbUsersDATA)
    {
        bool check = false;
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbUsers_ChangePass", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uID", _tbUsersDATA.uID));
                dbCmd.Parameters.Add(new SqlParameter("@uPass", _tbUsersDATA.uPass));
                dbCmd.ExecuteNonQuery();
                dbConn.Close();
                check = true;
            }
        }
        return check;
    }
    #endregion
    #region[tbUser_Delete]
    public static bool tbUsers_Delete(string uID)
    {
        bool check = false;
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbUsers_Delete", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbCmd.Parameters.Add(new SqlParameter("@uID", uID));
                dbConn.Open();
                dbCmd.ExecuteNonQuery();
                dbConn.Close();
                check = true;
            }
        }
        return check;
    }
    #endregion
    #region[tbUsers_GetByAll]
    public static List<tbUsersDATA> tbUsers_GetByAll()
    {
        List<tbUsersDATA> list = new List<tbUsersDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbUsers_GetByAll", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbUsersDATA objtbUsersDATA = new tbUsersDATA(
                        reader["uID"].ToString(),
                        reader["dpID"].ToString(),
                        reader["psID"].ToString(),
                        reader["uCode"].ToString(),
                        reader["uUser"].ToString(),
                        reader["uPass"].ToString(),
                        reader["uName"].ToString(),
                        reader["uDate"].ToString(),
                        reader["uAdd"].ToString(),
                        reader["uTel"].ToString(),
                        reader["uLevel"].ToString(),
                        reader["uOrd"].ToString(),
                        reader["uEmail"].ToString(),
                        reader["uAdmin"].ToString(),
                        reader["uImg"].ToString(),
                        reader["uCN"].ToString(),
                        reader["paId"].ToString());
                        list.Add(objtbUsersDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbUsers_GetByID]
    public static List<tbUsersDATA> tbUsers_GetByID(string uID)
    {
        List<tbUsersDATA> list = new List<tbUsersDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbUsers_GetByID", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uID", uID));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbUsersDATA objtbUsersDATA = new tbUsersDATA(
                        reader["uID"].ToString(),
                        reader["dpID"].ToString(),
                        reader["psID"].ToString(),
                        reader["uCode"].ToString(),
                        reader["uUser"].ToString(),
                        reader["uPass"].ToString(),
                        reader["uName"].ToString(),
                        reader["uDate"].ToString(),
                        reader["uAdd"].ToString(),
                        reader["uTel"].ToString(),
                        reader["uLevel"].ToString(),
                        reader["uOrd"].ToString(),
                        reader["uEmail"].ToString(),
                        reader["uAdmin"].ToString(),
                        reader["uImg"].ToString(),
                        reader["uCN"].ToString(),
                        reader["dpName"].ToString(),
                        reader["psName"].ToString(),
                        reader["paId"].ToString());
                        list.Add(objtbUsersDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbUsers_GetByuUser]
    public static List<tbUsersDATA> tbUsers_GetByuUser(string uUser)
    {
        List<tbUsersDATA> list = new List<tbUsersDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbUsers_GetByuUser", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uUser", uUser));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbUsersDATA objtbUsersDATA = new tbUsersDATA(
                        reader["uID"].ToString(),
                        reader["dpID"].ToString(),
                        reader["psID"].ToString(),
                        reader["uCode"].ToString(),
                        reader["uUser"].ToString(),
                        reader["uPass"].ToString(),
                        reader["uName"].ToString(),
                        reader["uDate"].ToString(),
                        reader["uAdd"].ToString(),
                        reader["uTel"].ToString(),
                        reader["uLevel"].ToString(),
                        reader["uOrd"].ToString(),
                        reader["uEmail"].ToString(),
                        reader["uAdmin"].ToString(),
                        reader["uImg"].ToString(),
                        reader["uCN"].ToString(),
                        reader["dpName"].ToString(),
                        reader["psName"].ToString(),
                        reader["paId"].ToString());
                        list.Add(objtbUsersDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbUsers_GetByuCode]
    public static List<tbUsersDATA> tbUsers_GetByuCode(string uCode)
    {
        List<tbUsersDATA> list = new List<tbUsersDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbUsers_GetByuCode", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uCode", uCode));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbUsersDATA objtbUsersDATA = new tbUsersDATA(
                        reader["uID"].ToString(),
                        reader["dpID"].ToString(),
                        reader["psID"].ToString(),
                        reader["uCode"].ToString(),
                        reader["uUser"].ToString(),
                        reader["uPass"].ToString(),
                        reader["uName"].ToString(),
                        reader["uDate"].ToString(),
                        reader["uAdd"].ToString(),
                        reader["uTel"].ToString(),
                        reader["uLevel"].ToString(),
                        reader["uOrd"].ToString(),
                        reader["uEmail"].ToString(),
                        reader["uAdmin"].ToString(),
                        reader["uImg"].ToString(),
                        reader["uCN"].ToString(),
                        reader["dpName"].ToString(),
                        reader["psName"].ToString(),
                        reader["paId"].ToString());
                        list.Add(objtbUsersDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbUsers_GetByMaxOrder]
    public static List<tbUsersDATA> tbUsers_GetByMaxOrder(string uLevel)
    {
        List<tbUsersDATA> list = new List<tbUsersDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbUsers_GetByMaxOrder", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uLevel", uLevel));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbUsersDATA objtbUsersDATA = new tbUsersDATA(
                        reader["uID"].ToString(),
                        reader["dpID"].ToString(),
                        reader["psID"].ToString(),
                        reader["uCode"].ToString(),
                        reader["uUser"].ToString(),
                        reader["uPass"].ToString(),
                        reader["uName"].ToString(),
                        reader["uDate"].ToString(),
                        reader["uAdd"].ToString(),
                        reader["uTel"].ToString(),
                        reader["uLevel"].ToString(),
                        reader["uOrd"].ToString(),
                        reader["uEmail"].ToString(),
                        reader["uAdmin"].ToString(),
                        reader["uImg"].ToString(),
                        reader["uCN"].ToString(),
                        reader["paId"].ToString());
                        list.Add(objtbUsersDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbUsers_GetBySub]
    public static List<tbUsersDATA> tbUsers_GetBySub(string uID)
    {
        List<tbUsersDATA> list = new List<tbUsersDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbUsers_GetBySub", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uID", uID));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbUsersDATA objtbUsersDATA = new tbUsersDATA(
                        reader["uID"].ToString(),
                        reader["dpID"].ToString(),
                        reader["psID"].ToString(),
                        reader["uCode"].ToString(),
                        reader["uUser"].ToString(),
                        reader["uPass"].ToString(),
                        reader["uName"].ToString(),
                        reader["uDate"].ToString(),
                        reader["uAdd"].ToString(),
                        reader["uTel"].ToString(),
                        reader["uLevel"].ToString(),
                        reader["uOrd"].ToString(),
                        reader["uEmail"].ToString(),
                        reader["uAdmin"].ToString(),
                        reader["uImg"].ToString(),
                        reader["uCN"].ToString(),
                        reader["dpName"].ToString(),
                        reader["psName"].ToString(),
                        reader["paId"].ToString());
                        list.Add(objtbUsersDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbUsers_GetBySub_NV]
    public static List<tbUsersDATA> tbUsers_GetBySub_NV(string uID)
    {
        List<tbUsersDATA> list = new List<tbUsersDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbUsers_GetBySub_NV", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uID", uID));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbUsersDATA objtbUsersDATA = new tbUsersDATA(
                        reader["uID"].ToString(),
                        reader["dpID"].ToString(),
                        reader["psID"].ToString(),
                        reader["uCode"].ToString(),
                        reader["uUser"].ToString(),
                        reader["uPass"].ToString(),
                        reader["uName"].ToString(),
                        reader["uDate"].ToString(),
                        reader["uAdd"].ToString(),
                        reader["uTel"].ToString(),
                        reader["uLevel"].ToString(),
                        reader["uOrd"].ToString(),
                        reader["uEmail"].ToString(),
                        reader["uAdmin"].ToString(),
                        reader["uImg"].ToString(),
                        reader["uCN"].ToString(),
                        reader["dpName"].ToString(),
                        reader["psName"].ToString(),
                        reader["paId"].ToString());
                        list.Add(objtbUsersDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbUsers_GetBySub_CN_ChuyenTruong]
    public static List<tbUsersDATA> tbUsers_GetBySub_CN_ChuyenTruong(string uID)
    {
        List<tbUsersDATA> list = new List<tbUsersDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbUsers_GetBySub_CN_ChuyenTruong", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uID", uID));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbUsersDATA objtbUsersDATA = new tbUsersDATA(
                        reader["uID"].ToString(),
                        reader["dpID"].ToString(),
                        reader["psID"].ToString(),
                        reader["uCode"].ToString(),
                        reader["uUser"].ToString(),
                        reader["uPass"].ToString(),
                        reader["uName"].ToString(),
                        reader["uDate"].ToString(),
                        reader["uAdd"].ToString(),
                        reader["uTel"].ToString(),
                        reader["uLevel"].ToString(),
                        reader["uOrd"].ToString(),
                        reader["uEmail"].ToString(),
                        reader["uAdmin"].ToString(),
                        reader["uImg"].ToString(),
                        reader["uCN"].ToString(),
                        reader["dpName"].ToString(),
                        reader["psName"].ToString(),
                        reader["paId"].ToString());
                        list.Add(objtbUsersDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbUsers_GetBySub_CN_QuanDoc]
    public static List<tbUsersDATA> tbUsers_GetBySub_CN_QuanDoc(string uID)
    {
        List<tbUsersDATA> list = new List<tbUsersDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbUsers_GetBySub_CN_QuanDoc", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uID", uID));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbUsersDATA objtbUsersDATA = new tbUsersDATA(
                        reader["uID"].ToString(),
                        reader["dpID"].ToString(),
                        reader["psID"].ToString(),
                        reader["uCode"].ToString(),
                        reader["uUser"].ToString(),
                        reader["uPass"].ToString(),
                        reader["uName"].ToString(),
                        reader["uDate"].ToString(),
                        reader["uAdd"].ToString(),
                        reader["uTel"].ToString(),
                        reader["uLevel"].ToString(),
                        reader["uOrd"].ToString(),
                        reader["uEmail"].ToString(),
                        reader["uAdmin"].ToString(),
                        reader["uImg"].ToString(),
                        reader["uCN"].ToString(),
                        reader["dpName"].ToString(),
                        reader["psName"].ToString(),
                        reader["paId"].ToString());
                        list.Add(objtbUsersDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbUsers_GetByLogin]
    public static List<tbUsersDATA> tbUsers_GetByLogin(string uUser, string uPass)
    {
        List<tbUsersDATA> list = new List<tbUsersDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbUsers_GetByLogin", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uUser", uUser));
                dbCmd.Parameters.Add(new SqlParameter("@uPass", uPass));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbUsersDATA objtbUsersDATA = new tbUsersDATA(
                        reader["uID"].ToString(),
                        reader["dpID"].ToString(),
                        reader["psID"].ToString(),
                        reader["uCode"].ToString(),
                        reader["uUser"].ToString(),
                        reader["uPass"].ToString(),
                        reader["uName"].ToString(),
                        reader["uDate"].ToString(),
                        reader["uAdd"].ToString(),
                        reader["uTel"].ToString(),
                        reader["uLevel"].ToString(),
                        reader["uOrd"].ToString(),
                        reader["uEmail"].ToString(),
                        reader["uAdmin"].ToString(),
                        reader["uImg"].ToString(),
                        reader["uCN"].ToString(),
                        reader["paId"].ToString());
                        list.Add(objtbUsersDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbUsers_GetByCheckLevel]
    public static List<tbUsersDATA> tbUsers_GetByCheckLevel(string uLevel)
    {
        List<tbUsersDATA> list = new List<tbUsersDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbUsers_GetByCheckLevel", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@uLevel", uLevel));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbUsersDATA objtbUsersDATA = new tbUsersDATA(
                        reader["uID"].ToString(),
                        reader["dpID"].ToString(),
                        reader["psID"].ToString(),
                        reader["uCode"].ToString(),
                        reader["uUser"].ToString(),
                        reader["uPass"].ToString(),
                        reader["uName"].ToString(),
                        reader["uDate"].ToString(),
                        reader["uAdd"].ToString(),
                        reader["uTel"].ToString(),
                        reader["uLevel"].ToString(),
                        reader["uOrd"].ToString(),
                        reader["uEmail"].ToString(),
                        reader["uAdmin"].ToString(),
                        reader["uImg"].ToString(),
                        reader["uCN"].ToString(),
                        reader["paId"].ToString());
                        list.Add(objtbUsersDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbUsers_GetByNguoiNhan_prID]
    public static List<tbUsersDATA> tbUsers_GetByNguoiNhan_prID(string prID)
    {
        List<tbUsersDATA> list = new List<tbUsersDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbUsers_GetByNguoiNhan_prID", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@prID", prID));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbUsersDATA objtbUsersDATA = new tbUsersDATA(
                        reader["uID"].ToString(),
                        reader["dpID"].ToString(),
                        reader["psID"].ToString(),
                        reader["uCode"].ToString(),
                        reader["uUser"].ToString(),
                        reader["uPass"].ToString(),
                        reader["uName"].ToString(),
                        reader["uDate"].ToString(),
                        reader["uAdd"].ToString(),
                        reader["uTel"].ToString(),
                        reader["uLevel"].ToString(),
                        reader["uOrd"].ToString(),
                        reader["uEmail"].ToString(),
                        reader["uAdmin"].ToString(),
                        reader["uImg"].ToString(),
                        reader["uCN"].ToString(),
                        reader["paId"].ToString());
                        list.Add(objtbUsersDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
    #region[tbUsers_GetByNguoiGui_prID]
    public static List<tbUsersDATA> tbUsers_GetByNguoiGui_prID(string prID)
    {
        List<tbUsersDATA> list = new List<tbUsersDATA>();
        using (SqlConnection dbConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
        {
            using (SqlCommand dbCmd = new SqlCommand("sp_tbUsers_GetByNguoiGui_prID", dbConn))
            {
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbConn.Open();
                dbCmd.Parameters.Add(new SqlParameter("@prID", prID));
                using (SqlDataReader reader = dbCmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        tbUsersDATA objtbUsersDATA = new tbUsersDATA(
                        reader["uID"].ToString(),
                        reader["dpID"].ToString(),
                        reader["psID"].ToString(),
                        reader["uCode"].ToString(),
                        reader["uUser"].ToString(),
                        reader["uPass"].ToString(),
                        reader["uName"].ToString(),
                        reader["uDate"].ToString(),
                        reader["uAdd"].ToString(),
                        reader["uTel"].ToString(),
                        reader["uLevel"].ToString(),
                        reader["uOrd"].ToString(),
                        reader["uEmail"].ToString(),
                        reader["uAdmin"].ToString(),
                        reader["uImg"].ToString(),
                        reader["uCN"].ToString(),
                        reader["paId"].ToString());
                        list.Add(objtbUsersDATA);
                    }
                }
                dbConn.Close();
            }
        }
        return list;
    }
    #endregion
}
